//
//  DataSingleton.m
//  MaiMaiGo
//
//  Created by 孙鹏飞 on 2017/4/6.
//  Copyright © 2017年 qian. All rights reserved.
//

#import "DataSingleton.h"

@interface DataSingleton () <NSCopying>

@end

@implementation DataSingleton

static DataSingleton * _data;

+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _data = [super allocWithZone:zone];
    });
    return _data;
}

+ (instancetype)sharedPerson
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _data = [[self alloc] init];
    });
    return _data;
}

- (id)copyWithZone:(NSZone *)zone
{
    return _data;
}

- (void)setCartNum:(NSString *)cartNum {
    _cartNum = cartNum;
    if (_refreshCartNum != nil) {
        _refreshCartNum();
    }
}

@end

